#ifndef __STATICDATA_HASHER_H__
#define __STATICDATA_HASHER_H__

#ifdef WIN32
#include <hash_map>
using namespace stdext;
#else
#include <ext/hash_map>
using namespace __gnu_cxx;
#endif

#include <string>

/**
* 	int64 harsher
*	Linux has not got a default hasher for long long int , so we defined this
*	harsher policer for hash map
**/
class Int64Harsher
{
public:
	enum
	{	// parameters for hash table
		bucket_size = 4,	// 0 < bucket_size
		min_buckets = 8,
		hash_seed = 0xdeadbeef,
	};

	size_t operator()(const __int64& _Keyval) const
	{
		return ((size_t)(_Keyval ^ hash_seed));
	}

	bool operator()(const __int64& _Keyval1, const __int64& _Keyval2) const
	{
		return (_Keyval1<_Keyval2);
	}
};

struct str_hash
{
	enum
	{	// parameters for hash table
		bucket_size = 4,	// 0 < bucket_size
		min_buckets = 8,	// min_buckets = 2 ^^ N, 0 < N
	};

	size_t operator()(const std::string &str) const
	{
		const char *__s = str.c_str();
		unsigned long __h = 0;
		for ( ; *__s; ++__s)
		{
			__h = 5 * __h + *__s;
		}
		return size_t(__h);
	}
	bool operator()(const std::string &str1, const std::string &str2) const
	{
		return str1 < str2;
	}

};

#endif //__STATICDATA_HASHER_H__
